<?php echo $this->Session->flash(); ?>
<h1>CONTROLES DE CALIDAD REALIZADOS AL PREDIO <?php echo $cod; ?></h1>
<table  id="tabla" class="tabla" >
    <thead>
        <tr>
            <th>Id</th>
            <th>Calificación</th>
            <th>Observaciones</th>
            <th>Editar</th>
            <th>Borrar</th>
        </tr>
    </thead>
    <tbody>
        <?php
        $editar = true;
        foreach ($qualityControls as $qualityControl):
            ?>
            <tr>
                <td><?php echo $qualityControl['QualityControl']['id'] ?></td>
                <td><?php
        switch ($qualityControl['QualityControl']['calificacion']) {
            case 1:
                echo "PENDIENTE";
                break;
            case 2:
                echo "REQUIERE DOCUMENTO";
                break;
            case 3:
                echo "NO CUMPLE";
                break;
            case 4:
                echo "CUMPLE";
                break;
        }
            ?></td>
                <td><?php echo $qualityControl['QualityControl']['observaciones'] ?></td>
                <td><?php if ($this->Session->read('publicado') == 0 and $editar) echo $ajax->link($html->image('editar.gif', array('width' => '30', 'heigth' => '30', 'alt' => 'Editar control')), array('controller' => 'quality_controls', 'action' => 'edit', $predio, $qualityControl['QualityControl']['id']), array('update' => 'content', 'indicator' => 'loading', 'escape' => false, 'complete' => 'cargar()')); ?></td>
                <td><?php if ($this->Session->read('publicado') == 0 and $editar) echo $ajax->link($html->image('borrar.png', array('width' => '30', 'heigth' => '30', 'alt' => 'Borrar control')), array('controller' => 'quality_controls', 'action' => 'delete', $predio, $qualityControl['QualityControl']['id']), array('update' => 'content', 'indicator' => 'loading', 'escape' => false), 'Desea borrar el registro?'); ?></td>
            </tr>
        <?php 
        $editar = false;
        endforeach; ?>
    </tbody>
</table>
<br>
<br>
<?php
if ($this->Session->read('publicado') == 0)
    echo $ajax->link('<label>Adicionar Control de Calidad</label>' . $html->image('adicionar.gif', array('width' => '30', 'heigth' => '30', 'alt' => 'Adicionar Control')), array('controller' => 'quality_controls', 'action' => 'add', $predio), array('update' => 'content', 'indicator' => 'loading', 'escape' => false, 'complete' => 'cargar()'));
?>